package com.zhuangjie.shop.dto.activity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.zhuangjie.mvc.validator.annotate.PositiveNumber;
import com.zhuangjie.mvc.validator.annotate.ValidNumberEnumsString;
import com.zhuangjie.mvc.validator.annotate.ValidTimeRangeString;
import com.zhuangjie.mvc.validator.valid.DefaultGroup;
import com.zhuangjie.mvc.validator.valid.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

/**
 * 新客立减活动编辑或添加DTO
 */
@Data
public class NewCustomerActivityDTO {
    @ApiModelProperty("参与活动id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @NotNull(groups = UpdateGroup.class,message = "更新必须带id")
    private Long id;

    @ApiModelProperty("优惠值")
    @TableField("value")
    @PositiveNumber(groups = DefaultGroup.class)
    private String value;

    @ApiModelProperty("适用顾客类型（0:全部用户 1:会员 2 新客 ）")
    @TableField("customer_type")
    private Short customerType;

    @ApiModelProperty("活动开始时间")
    @TableField("start_date")
    @NotNull(groups = DefaultGroup.class, message = "活动开始时间不能为空")
    private LocalDateTime startDate;

    @ApiModelProperty("活动结束时间")
    @TableField("end_date")
    private LocalDateTime endDate;

    @ApiModelProperty("适用的周(1,2,3...,7)")
    @TableField(value = "weeks")
    @ValidNumberEnumsString(groups = DefaultGroup.class ,delimiter = ",")
    private String weeks;

    @ApiModelProperty("适用的时间段(12:00-14:00,...)")
    @TableField("time_ranges")
    @ValidTimeRangeString(groups = DefaultGroup.class,message = "时段格式有误",delimiter = ",")
    private String timeRanges;




}
